package demo;


import com.richstonedt.rziomp.common.enums.ExceptionEnum;

/**
 * <b><code>CustomException</code></b>
 * <p/>
 * 自定义业务异常
 * <p/>
 * <b>Creation Time:</b> 2020/7/28 17:51.
 *
 * @author zhongxuelun
 * @since rziomp-be 1.0.0
 */
public class CustomException extends RuntimeException {

    private static final long serialVersionUID = 85300058336063778L;

    private Integer code;

    public CustomException(String message) {
        super(message);
        this.code = ExceptionEnum.FAIL.getCode();
    }

    public CustomException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public CustomException(ExceptionEnum exceptionEnum) {
        super(exceptionEnum.getMessage());
        this.code = exceptionEnum.getCode();
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}
